﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/MasterPage.master" AutoEventWireup="true" CodeFile="RoleMaintain.aspx.cs" Inherits="RoleManagement_RoleMaintain" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        .modalPopup
        {
            background-color: #FAD817;
            border-width: 3px;
            border-style: solid;
            border-color: Gray;
            padding: 3px;
            width: 250px;
        }
        .modalBackground
        {
            filter: alpha(opacity=70);
            opacity: 0.7;
        }
    </style>
    <script type="text/javascript" language="javascript" src="../Themes/MyCalendar/WdatePicker.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TabTitle" runat="Server">
        <asp:Literal runat="server" ID="title" Text="<%$ Resources:Resource,RoleManagement %>"></asp:Literal>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
    <div style="width: 100%;">
        <div class="queryDiv1">
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="divFrameHead">
                      <span class="querytextCss">
                    <%=Resources.Resource.Query%><%--查询条件--%></span> 
                    </td>
                </tr>
                <tr>
                    <td class="submitborder" style="padding-top: 15px; padding-bottom: 15px;">
                        <table style="margin-bottom: 10px;" width="95%" border="0" align="center" cellpadding="0"
                            cellspacing="0">
                            <tr>
                                <td class="submitborder4">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td class="submitFieldbg">
                                                 <%=Resources.Resource.RoleName%><%--角色名称--%>
                                            </td>
                                            <td align="left">
                                                <asp:TextBox ID="txtRoleName" runat="server" Width="120px"></asp:TextBox>
                                                &nbsp;
                                                 <asp:Button ID="btnSearch" runat="server" Text="<%$Resources:Resource,btnEnquiry %>"
                        OnClick="btnSearch_Click" />
                    <%--查 询--%>
                    &nbsp;&nbsp;
                    <asp:Button ID="btnAdd" runat="server" Text="<%$Resources:Resource,btnNew %>" OnClientClick="return Add()"
                        OnClick="btnSearch_Click" />
                    <%--新 建--%>
                                            </td>
                                        </tr> 
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div class="GridDivCss">
            <IMC:GridView ID="gvRoleList" runat="server" AllowPaging="true" AllowSorting="true"
                PageSize="10" OnRowCommand="gvRoleList_RowCommand" DataSourceID="RoleViewDataSource">
                <Columns>
                     <asp:TemplateField HeaderText="<%$Resources:Resource,RoleName%>" ItemStyle-HorizontalAlign="Center">
                        <%--角色名称--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbRoleName" runat="server" Text='<%#Eval("RoleName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources:Resource,RoleDescription %>" ItemStyle-HorizontalAlign="Center">
                        <%--描述--%>
                        <ItemTemplate>
                            &nbsp;<asp:Label ID="lbRoleDescription" runat="server" Text='<%#Eval("Description") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                   <asp:TemplateField HeaderText="<%$Resources:Resource,Operating%>" ItemStyle-HorizontalAlign="Center">
                        <%--操 作--%>
                        <ItemTemplate>
                            <a href="javascript:openWinForModify('<%#Eval("RoleID") %>','<%#Eval("RoleName") %>','<%#Eval("Description")%>')">
                                <%=Resources.Resource.btnMaintain%>
                            </a>
                            <%--修改--%>
                                 <a href="javascript:openWinForViewMember('<%#Eval("RoleID")%>')">
                                <%=Resources.Resource.MemberList%>
                            </a>
                            <%--选择成员--%>
                            <asp:LinkButton ID="lbtnDel1" runat="server" CommandName="Del" ValidationGroup="DelMassnahme"
                                CommandArgument='<%#Eval("RoleID") %>' OnClientClick="return isDel()"><%=Resources.Resource.btnDel%> </asp:LinkButton>
                            <%--删除--%>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </IMC:GridView>
            <asp:ObjectDataSource ID="RoleViewDataSource" runat="server" TypeName="RoleDataSource"
                SelectMethod="Select">
                <SelectParameters>
                    <asp:ControlParameter ControlID="txtRoleName" PropertyName="Text" Name="RoleName"
                        Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </div>
        <div style="text-align: center; padding-top: 10px;">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <input id="btnPreview" runat="server" type="button" value="预览" cssclass="buttonbgtwo"
                style="display: none;" />
            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnPreview"
                PopupControlID="Panel2" BackgroundCssClass="modalBackground" CancelControlID="btn_Cancel"
                DropShadow="true" PopupDragHandleControlID="Panel4" />
            <asp:Panel ID="Panel2" runat="server" Width="480px" Style="display: none" CssClass="modalPopup">
                <asp:Panel ID="Panel4" runat="server" Style="cursor: move; background-color: #DDDDDD;
                    border: solid 1px Gray; color: Black">
                    <div class="tagdivhead" style="background-color: #D6E0EE; padding-top: 8px">
                        <div class="divcenter">
                            <span>&nbsp;<asp:Label ID="lbtitle" runat="server" CssClass="querytextCss" Width="150px"
                                Height="16px"></asp:Label>
                            </span>
                        </div>
                    </div>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ModifytableCss">
                        <tr>
                            <td colspan="2" style="height: 1px">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: center">
                                <%=Resources.Resource.RoleName%><%--角色名称--%>
                                <asp:TextBox ID="txt_RoleName" runat="server" Width="100px"></asp:TextBox>
                            </td>
                            <td style="text-align: center">
                                <%=Resources.Resource.RoleDescription%><%--角色描述--%>
                                <asp:TextBox ID="txt_RoleDescription" runat="server" Width="100px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 1px">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="padding-bottom: 3; padding-top: 3">
                                <%--保 存--%>
                                <asp:Button ID="btn_Save" runat="server" Text="<%$Resources:Resource,btnSave%>" OnClick="btn_Save_Click" />
                                &nbsp;&nbsp;
                                <%--取 消--%>
                                <asp:Button ID="btn_Cancel" runat="server" Text="<%$Resources:Resource,btnClear%>" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6" style="height: 1px">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </asp:Panel>
        </div>
    </div>
    <script type="text/javascript">

        function openWinForModify(RoleID, RoleName, Description) {
            var selectPage = 'ModifyRoleInfo.aspx' + "?action=upd&RoleID=" + RoleID + "&RoleName=" + RoleName + "&Description=" + escape(Description);
            window.showModalDialog(selectPage, 'newwindow', 'dialogHeight: 450px; dialogWidth: 600px; center: yes; help: no; resizable: no; status: no;scroll:auto');
        }
        function openWinForViewMember(RoleID) {
            var selectPage = 'ViewMemberInRole.aspx' + "?action=select&RoleID=" + RoleID + "&time=" + (new Date()).getTime().toString();
            window.showModalDialog(selectPage, 'newwindow', 'dialogHeight: 450px; dialogWidth: 670px; center: yes; help: no; resizable: no; status: no;scroll:auto');
        }
        function Add() {
            document.getElementById("<%= lbtitle.ClientID%>").innerHTML = "<%=Resources.Resource.RoleAdd %>";  //新建角色
            document.getElementById("<%= txt_RoleName.ClientID%>").value = "";
            document.getElementById("<%= txt_RoleDescription.ClientID%>").value = "";
            document.getElementById('<%= btnPreview.ClientID%>').click();
            return false;
        }
        function isDel() {
            return confirm('<%=Resources.Resource.IsDelete %>');
        }
    </script>
</asp:Content>

